﻿<UserControl x:Class="ThemeMatic.Views.ColorSelectionView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:z="clr-namespace:ThemeMatic.Components">
    <Grid>

        <Grid.RowDefinitions>
            <RowDefinition Height="30" />
            <RowDefinition Height="30" />
            <RowDefinition Height="3*" />
            <RowDefinition Height="4*" />
        </Grid.RowDefinitions>

        <Grid.ColumnDefinitions>
            <ColumnDefinition />
            <ColumnDefinition />
            <ColumnDefinition Width="10" />

            <ColumnDefinition />
            <ColumnDefinition />
            <ColumnDefinition />
            <ColumnDefinition Width="10" />
            
            <ColumnDefinition />
            <ColumnDefinition />
        </Grid.ColumnDefinitions>

        <TextBlock Text="Branding" Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="2" HorizontalAlignment="Center" FontSize="18" FontWeight="SemiBold" />
        <TextBlock Text="Controls" Grid.Column="3" Grid.Row="0" Grid.ColumnSpan="3" HorizontalAlignment="Center" FontSize="18" FontWeight="SemiBold" />
        <TextBlock Text="Window" Grid.Column="7" Grid.Row="0" Grid.ColumnSpan="2" HorizontalAlignment="Center" FontSize="18" FontWeight="SemiBold" />


        <RadioButton Grid.Row="1" Grid.Column="0" Command="{Binding SelectColorCommand}" CommandParameter="{Binding ColorScheme.Primary}" HorizontalAlignment="Center" IsChecked="True">
            <TextBlock Text="Primary"  FontSize="16" />
        </RadioButton>

        <RadioButton Grid.Row="1" Grid.Column="1" Command="{Binding SelectColorCommand}" CommandParameter="{Binding ColorScheme.Secondary}" HorizontalAlignment="Center">
            <TextBlock Text="Secondary"  FontSize="16" />
        </RadioButton>

        <RadioButton Grid.Row="1" Grid.Column="3" Command="{Binding SelectColorCommand}" CommandParameter="{Binding ColorScheme.Chrome}" HorizontalAlignment="Center">
            <TextBlock Text="Chrome"  FontSize="16" />
        </RadioButton>

        <RadioButton Grid.Row="1" Grid.Column="4" Command="{Binding SelectColorCommand}" CommandParameter="{Binding ColorScheme.ChromeAlternate}" HorizontalAlignment="Center">
            <TextBlock Text="Chrome Alt."  FontSize="16" TextWrapping="Wrap" />
        </RadioButton>

        <RadioButton Grid.Row="1" Grid.Column="5" Command="{Binding SelectColorCommand}" CommandParameter="{Binding ColorScheme.Disabled}" HorizontalAlignment="Center">
            <TextBlock Text="Disabled"  FontSize="16" />
        </RadioButton>

        <RadioButton Grid.Row="1" Grid.Column="7" Command="{Binding SelectColorCommand}" CommandParameter="{Binding ColorScheme.Foreground}" HorizontalAlignment="Center">
            <TextBlock Text="Foreground"  FontSize="16" />
        </RadioButton>

        <RadioButton Grid.Row="1" Grid.Column="8" Command="{Binding SelectColorCommand}" CommandParameter="{Binding ColorScheme.Background}" HorizontalAlignment="Center">
            <TextBlock Text="Background"  FontSize="16" />
        </RadioButton>

        <Grid  Grid.Column="0" Grid.Row="2" DataContext="{Binding ColorScheme.Primary}" Margin="2.5">
            <Grid.RowDefinitions>
                <RowDefinition />
                <RowDefinition />
                <RowDefinition Height="2*" />
                <RowDefinition />
                <RowDefinition />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
            <Rectangle Fill="{Binding LightAccent2, Converter={StaticResource color2Brush}}" Grid.Row="0" />
            <Rectangle Fill="{Binding LightAccent1, Converter={StaticResource color2Brush}}" Grid.Row="1" />
            <Rectangle Fill="{Binding Base, Converter={StaticResource color2Brush}}" Grid.Row="2" />
            <Rectangle Fill="{Binding DarkAccent1, Converter={StaticResource color2Brush}}" Grid.Row="3" />
            <Rectangle Fill="{Binding DarkAccent2, Converter={StaticResource color2Brush}}" Grid.Row="4" />
            <TextBox Text="{Binding Base}" Grid.Row="5" Margin="2" />
        </Grid>

        <Grid Grid.Column="1" Grid.Row="2" DataContext="{Binding ColorScheme.Secondary}" Margin="2.5">
            <Grid.RowDefinitions>
                <RowDefinition />
                <RowDefinition />
                <RowDefinition Height="2*" />
                <RowDefinition />
                <RowDefinition />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
            <Rectangle Fill="{Binding LightAccent2, Converter={StaticResource color2Brush}}" Grid.Row="0" />
            <Rectangle Fill="{Binding LightAccent1, Converter={StaticResource color2Brush}}" Grid.Row="1" />
            <Rectangle Fill="{Binding Base, Converter={StaticResource color2Brush}}" Grid.Row="2" />
            <Rectangle Fill="{Binding DarkAccent1, Converter={StaticResource color2Brush}}" Grid.Row="3" />
            <Rectangle Fill="{Binding DarkAccent2, Converter={StaticResource color2Brush}}" Grid.Row="4" />
            <TextBox Text="{Binding Base}" Grid.Row="5" Margin="2" />
        </Grid>

        <Grid Grid.Column="3" Grid.Row="2" DataContext="{Binding ColorScheme.Chrome}" Margin="2.5">
            <Grid.RowDefinitions>
                <RowDefinition />
                <RowDefinition />
                <RowDefinition Height="2*" />
                <RowDefinition />
                <RowDefinition />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
            <Rectangle Fill="{Binding LightAccent2, Converter={StaticResource color2Brush}}" Grid.Row="0" />
            <Rectangle Fill="{Binding LightAccent1, Converter={StaticResource color2Brush}}" Grid.Row="1" />
            <Rectangle Fill="{Binding Base, Converter={StaticResource color2Brush}}" Grid.Row="2" />
            <Rectangle Fill="{Binding DarkAccent1, Converter={StaticResource color2Brush}}" Grid.Row="3" />
            <Rectangle Fill="{Binding DarkAccent2, Converter={StaticResource color2Brush}}" Grid.Row="4" />
            <TextBox Text="{Binding Base}" Grid.Row="5" Margin="2" />
        </Grid>

        <Grid Grid.Column="4" Grid.Row="2" DataContext="{Binding ColorScheme.ChromeAlternate}" Margin="2.5">
            <Grid.RowDefinitions>
                <RowDefinition />
                <RowDefinition />
                <RowDefinition Height="2*" />
                <RowDefinition />
                <RowDefinition />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
            <Rectangle Fill="{Binding LightAccent2, Converter={StaticResource color2Brush}}" Grid.Row="0" />
            <Rectangle Fill="{Binding LightAccent1, Converter={StaticResource color2Brush}}" Grid.Row="1" />
            <Rectangle Fill="{Binding Base, Converter={StaticResource color2Brush}}" Grid.Row="2" />
            <Rectangle Fill="{Binding DarkAccent1, Converter={StaticResource color2Brush}}" Grid.Row="3" />
            <Rectangle Fill="{Binding DarkAccent2, Converter={StaticResource color2Brush}}" Grid.Row="4" />
            <TextBox Text="{Binding Base}" Grid.Row="5" Margin="2" />
        </Grid>

        <Grid Grid.Column="5" Grid.Row="2" DataContext="{Binding ColorScheme.Disabled}" Margin="2.5">
            <Grid.RowDefinitions>
                <RowDefinition />
                <RowDefinition />
                <RowDefinition Height="2*" />
                <RowDefinition />
                <RowDefinition />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
            <Rectangle Fill="{Binding LightAccent2, Converter={StaticResource color2Brush}}" Grid.Row="0" />
            <Rectangle Fill="{Binding LightAccent1, Converter={StaticResource color2Brush}}" Grid.Row="1" />
            <Rectangle Fill="{Binding Base, Converter={StaticResource color2Brush}}" Grid.Row="2" />
            <Rectangle Fill="{Binding DarkAccent1, Converter={StaticResource color2Brush}}" Grid.Row="3" />
            <Rectangle Fill="{Binding DarkAccent2, Converter={StaticResource color2Brush}}" Grid.Row="4" />
            <TextBox Text="{Binding Base}" Grid.Row="5" Margin="2" />
        </Grid>

        <Grid Grid.Column="7" Grid.Row="2" DataContext="{Binding ColorScheme.Foreground}" Margin="2.5">
            <Grid.RowDefinitions>
                <RowDefinition />
                <RowDefinition />
                <RowDefinition Height="2*" />
                <RowDefinition />
                <RowDefinition />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
            <Rectangle Fill="{Binding LightAccent2, Converter={StaticResource color2Brush}}" Grid.Row="0" />
            <Rectangle Fill="{Binding LightAccent1, Converter={StaticResource color2Brush}}" Grid.Row="1" />
            <Rectangle Fill="{Binding Base, Converter={StaticResource color2Brush}}" Grid.Row="2" />
            <Rectangle Fill="{Binding DarkAccent1, Converter={StaticResource color2Brush}}" Grid.Row="3" />
            <Rectangle Fill="{Binding DarkAccent2, Converter={StaticResource color2Brush}}" Grid.Row="4" />
            <TextBox Text="{Binding Base}" Grid.Row="5" Margin="2" />
        </Grid>

        <Grid Grid.Column="8" Grid.Row="2" DataContext="{Binding ColorScheme.Background}" Margin="2.5">
            <Grid.RowDefinitions>
                <RowDefinition />
                <RowDefinition />
                <RowDefinition Height="2*" />
                <RowDefinition />
                <RowDefinition />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
            <Rectangle Fill="{Binding LightAccent2, Converter={StaticResource color2Brush}}" Grid.Row="0" />
            <Rectangle Fill="{Binding LightAccent1, Converter={StaticResource color2Brush}}" Grid.Row="1" />
            <Rectangle Fill="{Binding Base, Converter={StaticResource color2Brush}}" Grid.Row="2" />
            <Rectangle Fill="{Binding DarkAccent1, Converter={StaticResource color2Brush}}" Grid.Row="3" />
            <Rectangle Fill="{Binding DarkAccent2, Converter={StaticResource color2Brush}}" Grid.Row="4" />
            <TextBox Text="{Binding Base}" Grid.Row="5" Margin="2" />
        </Grid>

        <Grid Grid.ColumnSpan="5" Grid.Row="3" VerticalAlignment="Center" HorizontalAlignment="Center">
            <Image Source="../Resources/colorwheel.png" Stretch="Uniform" x:Name="colorWheel" />
            <Canvas  x:Name="selectionContainer" Width="{Binding ElementName=colorWheel, Path=ActualWidth}" Height="{Binding ElementName=colorWheel, Path=ActualHeight}" Background="Transparent" >
                <Ellipse Width="12" Height="12" Stroke="Black" StrokeThickness="2.5" Fill="Transparent" x:Name="selectionElipse" />
             </Canvas>
        </Grid>
        <StackPanel Grid.Column="7" Grid.ColumnSpan="2" Grid.Row="3">
            <TextBlock Text="Saturation" />
            <Slider x:Name="saturationSlider" Minimum="0" Maximum="1" Value="{z:DelayBinding SelectedColorSaturation, Delay=0:0:0.250}"  />
            <Rectangle Width="{Binding ElementName=saturationSilider, Path=ActualWidth}" Height="20" Fill="{Binding SaturationFill}" Margin="0,0,0,50" />
            <TextBlock Text="Lightness" />
            <Slider Minimum="0" Maximum="1" Value="{z:DelayBinding SelectedColorLightness, Delay=0:0:0.250}"  />
            <Rectangle Width="{Binding ElementName=saturationSilider, Path=ActualWidth}" Height="20" Fill="{Binding LightnessFill}" Margin="0,0,0,50" />
        </StackPanel>
        
    </Grid>
</UserControl>
